package com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.combustiblegas;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseService;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.utils.requestutil.HttpRequestUtil;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.mapper.DeviceAlarmLogMapper;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.mapper.UseDictMapper;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class ComAlarmInfoService extends BaseService {

	private static final Logger logger = LoggerFactory.getLogger(ComAlarmInfoService.class);

	@Resource
	public DeviceAlarmLogMapper deviceAlarmLogMapper;
	@Resource
	public UseDictMapper useDictMapper;

	/**
	 * 更多报警信息列表查询
	 * @param
	 * @return
	 */
	public RespEntity alarmInfoListPage(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return combustiblegas(jsonParam,"alarmInfoListPage","alarmInfo");
	}

	/**
	 * 字典组查询（目前用到电气火灾监测报警类型的列表查询）
	 * @param
	 * @return
	 */
	public RespEntity dictList(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiotJava(jsonParam,"dictList","alarmInfo");
	}

	/**
	 * 处置功能
	 * @param
	 * @return
	 */
	public RespEntity handle(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return combustiblegas(jsonParam,"handle","alarmInfo");
	}

	/**
	 * 报警信息详情
	 * @param
	 * @return
	 */
	public RespEntity detail(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiotJava(jsonParam,"detail","alarmInfo");
	}

	/**
	 * 报警日志添加
	 * @param
	 * @return
	 */
	public RespEntity add(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return combustiblegas(jsonParam,"add","alarmInfo");
	}

}
